package bishi.jinshanyun;

import java.util.*;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/09/15 21:19
 */
public class two {
    static int res = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] nums = new int[N];
        TreeMap<Integer,int[]> map = new TreeMap<>();//int[2],0:个数,1:可能性
        for (int i = 0; i < N; i++) {
            int key = sc.nextInt();
            if (map.containsKey(key)){
                map.get(key)[0]++;
            }else {
                map.put(key,new int[]{1,1});
            }
        }
        while (map.size()>0){
            Integer key = map.lastKey();
            int[] val = map.get(key);
            if (val[0]>1){
                if (map.containsKey(key/2)){
                    map.get(key)[0]++;
                }else {
                    map.put(key,new int[]{1,1});
                }
            }
        }
    }
}
